#include "mystringmap.h"
namespace nilyang {
void func_mapstr() {
  TStrStrMap tMap;
  tMap.insert(TStrStrPair("yes", "no"));
  tMap.insert(TStrStrPair("up", "down"));
  tMap.insert(TStrStrPair("left", "right"));
  tMap.insert(TStrStrPair("good", "bad"));
  tMap.insert(TStrStrPair("yes1", "no1"));
  tMap.insert(TStrStrPair("yes2", "no2"));
  tMap.insert(TStrStrPair("Good","Boy"));
  using std::cin;
  using std::cout;
  using std::endl;
  using std::string;

  string s;
  cout << "请输入一个字：" << endl;
  s = "ye2s";
  cout << "s=" << endl;
  string strValue = tMap[s];
  cout << "strValue = " << strValue << endl;
  if (strValue != "") {
    cout << "找到：" << strValue << endl;
  } else {
    TStrStrMap::iterator iter;
    bool bFound = false;
    for (iter = tMap.begin(); iter != tMap.end(); ++iter) {
      string strKey = iter->first;
      strValue = s;
      if (strValue == strKey) {
        cout << "找到：" << iter->first << endl;
        bFound = true;
      }
    }

    if (!bFound) {
      cout << "未找到" << endl;
    }
  }
}

}  // namespace nilyang
// void
// MyStringMap::PushKeyValue(const string_type& key, const string_type& value)
//{
//  mapStr.insert(key, value);
//}

// void
// MyStringMap::PushKeyValue(const value_type& mapStrStr)
//{
//  for (auto it = mapStrStr.begin(); it != mapStrStr.end(); ++it) {
//    mapStr.insert(std::make_pair(it->first, it->second));
//  }
//}

// const std::string&&
// MyStringMap::FindOrDefault(const std::string& key,
//                           const std::string& default_value) const
//{
//  auto it = mapStr.find(key);
//  if (it == mapStr.end())
//    return std::move(default_value);
//  return std::move(it->second);
//}
